﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace LetsDeal.Data
{
    public interface IGenericRepository
    {
        IEnumerable<TEntity> Get<TEntity>(Expression<Func<TEntity, bool>> filter = null,
            Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBy = null,
            string includeProperties = "") where TEntity : class;

        TEntity GetById<TEntity>(object id) where TEntity : class;
        IEnumerable<TEntity> GetAll<TEntity>() where TEntity : class;
        void Update<TEntity>(TEntity entity) where TEntity : class;
        void Create<TEntity>(TEntity entity) where TEntity : class;
        void Delete<TEntity>(TEntity entity) where TEntity : class;
        int SaveChanged(int userId, int companyId);
        int SaveChanged();
        void OpenConnection();
        void CloseConnection();
        IEnumerable<TEntity> ExecuteSqlQuery<TEntity>(string sql, params object[] param) where TEntity : class;
        int ExecuteSqlCommand(string sql, params object[] param);
        IEnumerable<TEntity> ExcuteStore<TEntity>(string name, params object[] param) where TEntity : class;
    }
}
